package org.wangchaocheng.cloudgallery.user.assembler;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import org.wangchaocheng.cloudgallery.commond.user.UserModifyCmd;
import org.wangchaocheng.cloudgallery.commond.user.UserRegisterCmd;
import org.wangchaocheng.cloudgallery.dto.user.UserDTO;

/**
 * 用户信息装配器
 * @author wangchaocheng
 * @date 2025/03/28
 */
@Mapper
public interface UserAssembler {

    UserAssembler INSTANCE = Mappers.getMapper(UserAssembler.class);

    @Mappings({
        @Mapping(target = "status", ignore = true),
        @Mapping(target = "id", ignore = true),
        @Mapping(target = "gmtModified", ignore = true),
        @Mapping(target = "gmtCreate", ignore = true)
    })
    UserDTO assembleDTO(UserRegisterCmd userRegisterCmd);

    @Mappings({
        @Mapping(target = "status", ignore = true),
        @Mapping(target = "gmtModified", ignore = true),
        @Mapping(target = "gmtCreate", ignore = true),
        @Mapping(target = "email", ignore = true),
        @Mapping(target = "phoneNumber", ignore = true),
        @Mapping(target = "username", ignore = true)
    })
    UserDTO assembleDTO(UserModifyCmd userModifyCmd);


}
